<?php get_header(); ?>
        
        <!-- MIDDLE -->
        <section class="middle row">
		
			<!-- TAGLINE -->
			<?php if ( get_option( 'tagline_text' ) != "" ) { echo '<div class="tagline span12"><h3>' . stripcslashes( get_option( 'tagline_text' ) ) . '</h3></div>'; } ?>
			<!-- TAGLINE -->
        
			<?php
			
				if ( get_option( 'slider_type' ) == "Big" )
				{
					$args = array( 'post_type' => 'slides', 'posts_per_page' => -1 );
					$loop = new WP_Query( $args );
				
					if ( $loop->have_posts() ) :
					
						?>
						
							<!-- big SLIDER -->
							<div class="flex-container main-slider main-slider-narrow span12">
							
								<?php
								
									if ( get_option( 'enable_video_in_slider_area' ) )
									{
										echo '<div class="media-box video-container">';
										
											echo stripcslashes( get_option( 'video_code_in_slider_area' ) );
											
										echo '</div>';
									}
									else
									{
									?>
									
										<div class="flexslider">
									  
											<ul class="slides">
											
												<?php
													
													while ( $loop->have_posts() ) : $loop->the_post();
													
														if ( ! get_option( $post->ID . 'for_blog_page_slider' ) )
														{
														
															echo '<li>';
															
																$slide_img_alt_text = get_option( $post->ID . 'slide_img_alt_text' );
														
																if ( has_post_thumbnail() )
																{
																	$image_link = get_post_meta( $post->ID, 'image_link', true );
																	$image_new_window = get_post_meta( $post->ID, 'image_new_window', true );
																	
																	if ( $image_link )
																	{
																		?>
																		
																			<a <?php if ( $image_new_window ) { echo 'target="_blank"'; } ?> href="<?php echo $image_link; ?>">
																				
																				<?php the_post_thumbnail( 'full', array( 'alt' => $slide_img_alt_text, 'title' => "" ) ); ?>
																				
																			</a>
																		
																		<?php
																	}
																	else
																	{
																		the_post_thumbnail( 'full', array( 'alt' => $slide_img_alt_text, 'title' => "" ) );
																	}
																}
																else
																{
																	?>
																	
																		<img src="<?php echo get_template_directory_uri(); ?>/img/slider/slider-placeholder.png" alt="<?php echo $slide_img_alt_text; ?>" />
																	
																	<?php
																}
																
																$image_caption = get_post_meta( $post->ID, 'image_caption', true );
																
																if ( $image_caption )
																{
																	echo '<h2 class="flex-caption">';
																		echo $image_caption;
																	echo '</h2>';
																}
															
															echo '</li>';
														}
														// end for_blog_page_slider
														
													endwhile;
												
												?>
												
											</ul>
										
										</div>
								
									<?php
									}
								
								?>
							  
							</div>
							<!-- end big SLIDER -->
							
						<?php
				
					endif;
					
					wp_reset_query();
				}
				else
				{
					$args = array( 'post_type' => 'slides', 'posts_per_page' => -1 );
					$loop = new WP_Query( $args );
					
					if ( $loop->have_posts() ) :
				
					?>
					
						<!-- small SLIDER -->
						<div class="flex-container main-slider main-slider-narrow span8">
						
							<?php
							
								if ( get_option( 'enable_video_in_slider_area' ) )
								{
									echo '<div class="media-box video-container">';
									
										echo stripcslashes( get_option( 'video_code_in_slider_area' ) );
										
									echo '</div>';
								}
								else
								{
								?>
								
									<div class="flexslider">
								  
										<ul class="slides">
										
											<?php
											
												while ( $loop->have_posts() ) : $loop->the_post();
												
													if ( ! get_option( $post->ID . 'for_blog_page_slider' ) )
													{
														echo '<li>';
														
															$slide_img_alt_text = get_option( $post->ID . 'slide_img_alt_text' );
													
															if ( has_post_thumbnail() )
															{
																$image_link = get_post_meta( $post->ID, 'image_link', true );
																$image_new_window = get_post_meta( $post->ID, 'image_new_window', true );
																
																if ( $image_link )
																{
																	?>
																	
																		<a <?php if ($image_new_window) echo 'target="_blank"' ?> href="<?php echo $image_link; ?>">
																		
																			<?php the_post_thumbnail( 'full', array( 'alt' => $slide_img_alt_text, 'title'	=> "" ) ); ?>
																		
																		</a>
																		
																	<?php
																}
																else
																{
																	the_post_thumbnail( 'full', array( 'alt' => $slide_img_alt_text, 'title' => "" ) );
																}
															}
															else
															{
																?>
																
																	<img src="<?php echo get_template_directory_uri(); ?>/img/slider/slider-placeholder.png" alt="<?php echo $slide_img_alt_text; ?>">
																	
																<?php
															}
															
															$image_caption = get_post_meta( $post->ID, 'image_caption', true );
															
															if ( $image_caption )
															{
																echo '<h2 class="flex-caption">';
																	echo $image_caption;
																echo '</h2>';
															}
														
														echo '</li>';
													
													}
													// end for_blog_page_slider
													
												endwhile;
										
										?>
											
										</ul>
									
									</div>
									
								<?php
								}
							
							?>
						  
						</div>
						<!-- end small SLIDER -->
						
					<?php
						
						endif;
					
						wp_reset_query();
						
					?>
						
						<!-- ASIDE -->
						<aside class="aside span4">
						
						<?php
						
							if ( get_option( 'hide_cta_info' ) )
							{
								if ( ! function_exists( 'dynamic_sidebar' ) || ! dynamic_sidebar( "cta_sidebar" ) ) :
								endif;
							}
							else
							{
								if ( get_option( 'cta_title' ) != "" ) { echo '<h2>' . stripcslashes( get_option( 'cta_title' ) ) . '</h2>'; }
								
								if ( get_option( 'cta_text' ) != "" ) { echo '<p>' . stripcslashes( get_option( 'cta_text' ) ) . '</p>'; }

								if ( get_option( 'cta_button_text' ) != "" )
								{
									$cta_button_color = get_option( 'cta_button_color' );
									
									if ( $cta_button_color == "White" ) { $cta_button_color_out = "btn-default"; }
									elseif ( $cta_button_color == "Blue" ) { $cta_button_color_out = "btn-primary"; }
									elseif ( $cta_button_color == "Sky Blue" ) { $cta_button_color_out = "btn-info"; }
									elseif ( $cta_button_color == "Green" ) { $cta_button_color_out = "btn-success"; }
									elseif ( $cta_button_color == "Yellow" ) { $cta_button_color_out = "btn-warning"; }
									elseif ( $cta_button_color == "Red" ) { $cta_button_color_out = "btn-danger"; }
									else { $cta_button_color_out = ""; }
									
									if ( get_option( 'cta_button_url' ) != "" ) { $cta_button_url_out = 'href="' . get_option( 'cta_button_url' ) . '"'; }
								
									echo '<p><a class="btn btn-large ' . $cta_button_color_out . '" ' . $cta_button_url_out . '>' . stripcslashes( get_option( 'cta_button_text' ) ) . '</a></p>';
								}
							}
							
						?>
						
						</aside>
						<!-- end ASIDE -->
						
					<?php
				
				}
			?>

			<!-- WIDGETS -->
			<?php
			
				if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( "homepage_sidebar" ) ) :
				endif;
			
			?>
			<!-- end WIDGETS -->

        </section>
        <!-- end MIDDLE -->
		
    </div>
    <!-- end CONTAINER -->
	
<?php

	get_footer();
	
?>